import Taro, { Component } from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
import { AtList, AtListItem, AtSwipeAction } from "taro-ui"
import './dynamicmessage.css'
import { $navigateTo } from '../../../global';
import reactMixin from 'react-mixin';
import myJs from './dynamicmessageJs.js'
import app from '../../../main.js'

export default class DynamicMessage extends Component {

  config = {
    navigationBarTitleText: '动态消息'
  }
  constructor() {
    super(...arguments);
    this.state = this.getData();
  }
  init() {}
  go(url) {
    $navigateTo(url);
  }

  render() {
    return (
      <View className="dynamic-message">
        <AtList>
          {this.state.chat_messages.items.map((item) =>
            <AtSwipeAction options={[
              {
                text: '取消',
                style: {
                  backgroundColor: '#6190E8'
                }
              },
              {
                text: '删除',
                style: {
                  backgroundColor: '#FF4949'
                }
              }
            ]}
            >
              <AtListItem onClick={this.go.bind(this, '../dongtaixiangqing/dongtaixiangqing')} title={item.title} arrow='right' />
            </AtSwipeAction>
          )}
        </AtList>
      </View>
    )
  }
}
reactMixin.onClass(DynamicMessage, myJs);